﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using SelfService.Model.Models;
using SelfService.Model;


namespace SelfService.ViewModel.SysOperatorVMs
{
    public partial class SysOperatorTemplateVM : BaseTemplateVM
    {
        [Display(Name = "名称")]
        public ExcelPropety Name_Excel = ExcelPropety.CreateProperty<SysOperator>(x => x.Name);
        [Display(Name = "描述")]
        public ExcelPropety Description_Excel = ExcelPropety.CreateProperty<SysOperator>(x => x.Description);
        [Display(Name = "操作员分类")]
        public ExcelPropety Group_Excel = ExcelPropety.CreateProperty<SysOperator>(x => x.GroupId);
        [Display(Name = "客户端")]
        public ExcelPropety Client_Excel = ExcelPropety.CreateProperty<SysOperator>(x => x.ClientId);
        [Display(Name = "密码")]
        public ExcelPropety Password_Excel = ExcelPropety.CreateProperty<SysOperator>(x => x.Password);
        [Display(Name = "Token")]
        public ExcelPropety Token_Excel = ExcelPropety.CreateProperty<SysOperator>(x => x.Token);
        [Display(Name = "是否启用")]
        public ExcelPropety IsEnable_Excel = ExcelPropety.CreateProperty<SysOperator>(x => x.IsEnable);

	    protected override void InitVM()
        {
            Group_Excel.DataType = ColumnDataType.ComboBox;
            Group_Excel.ListItems = DC.Set<SysOperatorGroup>().GetSelectListItems(Wtm, y => y.Name);
            Client_Excel.DataType = ColumnDataType.ComboBox;
            Client_Excel.ListItems = DC.Set<SysClient>().GetSelectListItems(Wtm, y => y.Name);
        }

    }

    public class SysOperatorImportVM : BaseImportVM<SysOperatorTemplateVM, SysOperator>
    {

    }

}
